
<?php

class A
{
	 public function test() {
        echo 'This is the method test of class FOO';
    }
}

class B
{
	 private $a, $b;
    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }
    public function test() {
        echo 'This is the method test of class BAR<br />';
        echo '$this->a=', $this->a, ', $this->b=', $this->b;
    }
}

function newInstance($name) {
    $arguments = func_get_args();VAR_DUMP($arguments);
    $className = array_shift($arguments);
    $class = new ReflectionClass($className);
    return $class->newInstanceArgs($arguments);
}

//$foo = newInstance('A');
//$foo->test();
//��������
//This is the method test of class FOO

//$bar = newInstance('B', array(3,5));
//$bar->test();
//��������
//This is the method test of class BAR
//$this->a=3, $this->b=5

//$a=new A();
//var_dump(is_object($a));

//$first=array(1,2,3,4);
//$k=6;
//$v=55;
// !isset($first[$k]) ? ($first[] = $v) : ($first[$k] = $v);

//$a=-1;
 //var_dump(!$a);

class C
{
    public function __construct() {
        var_dump(1);
           $numargs = func_num_args();
    echo "Number of arguments: $numargs<br />\n";
    if ($numargs >= 2) {
        echo "Second argument is: " . func_get_arg(1) . "<br />\n";
    }
    $arg_list = func_get_args();
    for ($i = 0; $i < $numargs; $i++) {
        echo "Argument $i is: " . (is_array($arg_list[$i])?'array()':$arg_list[$i]) . "<br />\n";
    }

    }
}

class D extends C
{
      public function __construct() {
         // $ARR=ARRAY();
          parent::__construct(1,2,3);
        var_dump(2);
    }
}

var_dump('2x'=='2x1');